from urllib import request
from http import cookiejar

url = 'https://baike.baidu.com/item/Python/407313'
response1 = request.urlopen(url)
if response1.getcode() == 200:
    print(response1.read())
else:
    print('response1 failed.')

cj = cookiejar.CookieJar()
opener = request.build_opener(request.HTTPCookieProcessor(cj))
request.install_opener(opener)
response2 = request.urlopen(url)
print(cj)
print(response2.read())


